from os.path import join, abspath
import json
from backend.experiment.clue.afqmc.scheme1.implement import AFQMCImplement as S1

SAMPLE_LIMIT = 50


class AFQMCImplement(S1):
    @classmethod
    def _read_train_records(cls) -> list:
        with open(join(cls.data_dir(), 'train.json'), 'r', encoding='utf8') \
                as file:
            records = [
                json.loads(each) for each in file.readlines()[:SAMPLE_LIMIT]]
        return records

    @classmethod
    def cache_dir(cls) -> str:
        return join(cls.work_dir(), 'cache')

    @classmethod
    def work_dir(cls) -> str:
        return abspath(join(__file__, '..'))
